package com.sky.controller.admin;
import com.sky.entity.ShopStatus;
import com.sky.result.Result;
import com.sky.service.ShopStatusService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;

/**
 * @author 符健清
 * @version 1.0
 * 店家 状态 控制器
 */
@SuppressWarnings({"all"})
@Api (tags = "商家状态接口")
@RestController()
@Slf4j
public class ShopController {
    @Autowired
    private ShopStatusService shopStatusService;
    @ApiOperation("查询商家状态")
    @GetMapping("/admin/shop/status")
    public Result   shopStatus() {
         List<ShopStatus> list=shopStatusService.selectShopStatus();
        ShopStatus shopStatus=list.get(0);
        Result result = new Result();
        return result.success(shopStatus.getStatus());
    }
//     修改商家状态
    @ApiOperation("修改商家状态")
    @PutMapping("/admin/shop/{status}")
    public Result  updateShopStatus(@PathVariable Integer status) {
        log.info("设置状态 status:{}" ,status);
        shopStatusService.updateShopStatus(status);
        Result<Object> result = new Result<>();
        return result.success();
    }
}
